<?php

/*
*	Accounts DAO
*/

include_once('framework/DataAccessObject.php');

class AccountsDAO extends DataAccessObject
{
	function addUser($name, $token, $level)
	{
			return $this->db->execute("INSERT INTO accounts VALUES (?, ?, ?)", array($name, $token, $level));
	}

	function getLevel($name)
	{
		return $this->db->executeSet("SELECT level FROM accounts WHERE name=?", array($name));
	}

	function getToken($name)
	{
		return $this->db->executeField("SELECT token FROM accounts WHERE name=?", array($name));
	}

	function deleteAllAccounts()
	{
		return $this->db->execute("DELETE ALL FROM accounts");
	}

	function deleteAccount($name)
	{
		return $this->db->execute("DELETE FROM accounts WHERE name=?", array($name));
	}
}
?>
